/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.models.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "tblUserAnswer", catalog = "cungonbaiDB", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TblUserAnswer.findAll", query = "SELECT t FROM TblUserAnswer t"),
    @NamedQuery(name = "TblUserAnswer.findByUserAnswerId", query = "SELECT t FROM TblUserAnswer t WHERE t.userAnswerId = :userAnswerId")})
public class TblUserAnswer implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "userAnswerId", nullable = false)
    private Integer userAnswerId;
    @JoinColumn(name = "roomUserId", referencedColumnName = "roomUserId")
    @ManyToOne
    private TblRoomUser roomUserId;
    @JoinColumn(name = "questionId", referencedColumnName = "questionId")
    @ManyToOne
    private TblQuestion questionId;
    @JoinColumn(name = "answerId", referencedColumnName = "answerId")
    @ManyToOne
    private TblAnswer answerId;

    public TblUserAnswer() {
    }

    public TblUserAnswer(Integer userAnswerId) {
        this.userAnswerId = userAnswerId;
    }

    public Integer getUserAnswerId() {
        return userAnswerId;
    }

    public void setUserAnswerId(Integer userAnswerId) {
        this.userAnswerId = userAnswerId;
    }

    public TblRoomUser getRoomUserId() {
        return roomUserId;
    }

    public void setRoomUserId(TblRoomUser roomUserId) {
        this.roomUserId = roomUserId;
    }

    public TblQuestion getQuestionId() {
        return questionId;
    }

    public void setQuestionId(TblQuestion questionId) {
        this.questionId = questionId;
    }

    public TblAnswer getAnswerId() {
        return answerId;
    }

    public void setAnswerId(TblAnswer answerId) {
        this.answerId = answerId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (userAnswerId != null ? userAnswerId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblUserAnswer)) {
            return false;
        }
        TblUserAnswer other = (TblUserAnswer) object;
        if ((this.userAnswerId == null && other.userAnswerId != null) || (this.userAnswerId != null && !this.userAnswerId.equals(other.userAnswerId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.models.entities.TblUserAnswer[ userAnswerId=" + userAnswerId + " ]";
    }
    
}
